'''
Created 7/2/12
Modified 7/2/12

Reads a text file of space-delimited values into an array

Run via python
@author: drlittle
'''

# import numpy
import numpy as np

# read text file into a 1D array 
x = np.fromfile('svvdata.txt', dtype=float, sep=' ')
print 'shape (rows, columns):', x.shape

# reshape array into a 2D array with 4 columns [x, y, z, value]
# and as many rows as needed to consume all values
x = x.reshape(-1,4)

# print first and last several rows of array
print 'gene expression data [ x y z value ]:'
print 'shape (rows, columns):', x.shape
print x

